function promiseMaker(time) {
  return new Promise((resolve, reject) => {
    setTimeout(() => resolve(time), time)
  })
}

const urls  = [10, 100, 0, 1000, 7, 5, 9, 1500, 28, 89];

// Promise.all(urls).then(value => console.log(value))

function getData(arr) {
  return new Promise((resolve, reject) => {
    // 正在执行数量计数器，判断正在执行的promise是否达到三个
    let index = 0;

    // 完成数量计数器，判断所有promise是否全部执行完毕
    let num = 0;
    let result = [];
    function addData(i, value) {
      result[i] = value;
      num++;
      let _i = index + num - 1;
      if(index >= 3 && num < arr.length - 2) {
        promiseMaker(arr[_i]).then(value => addData(_i, value), reason => addData(_i, reason));
      }
      if(num === arr.length) resolve(result)
    }
    for(let i = 0;i < 3;i++) {
      promiseMaker(arr[i]).then(value => addData(i, value), reason => addData(i, reason));
      index++;
    }
  })
}

getData(urls).then(value => console.log(value))